<div class="row">
    <div class="col-sm-20">
        <h1 class="pagetitle" translate lib="web">resource</h1>
    </div>
</div>

<pre ng-show="ErrorMessage!=null">{{ ErrorMessage }}</pre>
<div ng-show="ctrl.errormessage != ''"" class=" alert alert-danger" role="alert">{{ctrl.errormessage}}</div>
<form ng-submit="ctrl.submit()" class="form-horizontal" role="form" autocomplete="off">

    <div class="form-group">
        <label for="provider" class="col-sm-2 control-label" translate lib="web">target</label>
        <div class="col-sm-4">
            <select class="form-control" ng-model="ctrl.model.target">
                <option value="customer">Customer</option>
                <option value="user">User</option>
            </select>
        </div>
    </div>
    <div class="form-group" ng-show="ctrl.model.target=='customer'">
        <label for="provider" class="col-sm-2 control-label" translate lib="web">customerassign</label>
        <div class="col-sm-4">
            <select class="form-control" ng-model="ctrl.model.customerassign">
                <option value="singlevariant">Single product</option>
                <option value="multiplevariants">Multiple products</option>
            </select>
        </div>
    </div>
    <div class="form-group" ng-show="ctrl.model.target=='user'">
        <label for="provider" class="col-sm-2 control-label" translate lib="web">userassign</label>
        <div class="col-sm-4">
            <select class="form-control" ng-model="ctrl.model.userassign">
                <option value="singlevariant">Single product</option>
                <option value="multiplevariants">Multiple products</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="name" class="col-sm-2 control-label" translate lib="web">name</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.name" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group">
        <label for="allowdirectassign" class="col-sm-2 control-label" translate lib="web">allowdirectassign</label>
        <div class="col-sm-4">
            <input type="checkbox" ng-model="ctrl.model.allowdirectassign" class="input-md"
                ng-disabled="ctrl.loading==true" />

        </div>
    </div>
    <div class="form-group">
        <label for="allowdirectassign" class="col-sm-2 control-label" translate lib="web">defaultmetadata</label>
        <div class="col-sm-4">
            <textarea json-text class='form-control' rows='1' data-min-rows='1'
                ng-model="ctrl.model.defaultmetadata"></textarea>

        </div>
    </div>


    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" ng-disabled="ctrl.loading==true" class="btn btn-success" translate
                lib="web">Save</button>
        </div>
    </div>

    <div class="border rounded p-20" ng-repeat="product in ctrl.model.products">
        <h4>{{product.name}}</h4>

        <div class="form-group" ng-show="ctrl.model.target=='customer'">
            <label for="provider" class="col-sm-2 control-label" translate lib="web">customerassign</label>
            <div class="col-sm-4">
                <select class="form-control" ng-model="product.customerassign">
                    <option value="single">Single</option>
                    <option value="multiple">Multiple</option>
                    <option value="metered">Metered</option>
                </select>
            </div>
        </div>
        <div class="form-group" ng-show="ctrl.model.target=='user'">
            <label for="provider" class="col-sm-2 control-label" translate lib="web">userassign</label>
            <div class="col-sm-4">
                <select class="form-control" ng-model="product.userassign">
                    <option value="single">Single</option>
                    <option value="multiple">Multiple</option>
                    <option value="metered">Metered</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="stripeproduct" class="col-sm-2 control-label" translate lib="web">stripeproduct</label>
            <div class="col-sm-4">
                <input ng-model="product.stripeproduct" class="form-control input-md"
                    ng-disabled="ctrl.loading==true" />
            </div>
        </div>
        <div class="form-group">
            <label for="stripeprice" class="col-sm-2 control-label" translate lib="web">stripeprice</label>
            <div class="col-sm-4">
                <input ng-model="product.stripeprice" class="form-control input-md" ng-disabled="ctrl.loading==true" />
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label" translate lib="web">name</label>
            <div class="col-sm-4">
                <input ng-model="product.name" class="form-control input-md" ng-disabled="ctrl.loading==true" />
            </div>
        </div>
        <div class="form-group">
            <label for="allowdirectassign" class="col-sm-2 control-label" translate lib="web">allowdirectassign</label>
            <div class="col-sm-4">
                <input type="checkbox" ng-model="product.allowdirectassign" class="input-md"
                    ng-disabled="ctrl.loading==true" />

            </div>
        </div>
        <div class="form-group">
            <label for="added_resourceid" class="col-sm-2 control-label" translate lib="web">added resourceid</label>
            <div class="col-sm-4">
                <input ng-model="product.added_resourceid" class="form-control input-md"
                    ng-disabled="ctrl.loading==true" />
            </div>
        </div>
        <div class="form-group">
            <label for="added_stripeprice" class="col-sm-2 control-label" translate lib="web">added stripeprice</label>
            <div class="col-sm-4">
                <input ng-model="product.added_stripeprice" class="form-control input-md"
                    ng-disabled="ctrl.loading==true" />
            </div>
        </div>
        <div class="form-group">
            <label for="added_quantity_multiplier" class="col-sm-2 control-label" translate lib="web">added quantity
                multiplier</label>
            <div class="col-sm-4">
                <input ng-model="product.added_quantity_multiplier" type="number" class="form-control input-md"
                    ng-disabled="ctrl.loading==true" />
            </div>
        </div>

        <div class="form-group">
            <label for="allowdirectassign" class="col-sm-2 control-label" translate lib="web">metadata</label>
            <div class="col-sm-4">
                <textarea json-text class='form-control' rows='1' data-min-rows='1'
                    ng-model="product.metadata"></textarea>

            </div>
        </div>

    </div>


</form>